﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http.SelfHost;
using System.Web.Http;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Net.Http;
using static System.Collections.Specialized.BitVector32;

namespace WpfApp2
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            HttpClient client = new HttpClient();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Uri myUri = new Uri(@"http://localhost:9999");
            HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(myUri);
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
            routeTemplate: "yaoshun/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
            HttpSelfHostServer server = new HttpSelfHostServer(config);
            server.OpenAsync().Wait();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {

        }
    }
}
